<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: TimeZone</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">TimeZone</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/vendor/rails/activesupport/lib/active_support/values/time_zone_rb.html">
                vendor/rails/activesupport/lib/active_support/values/time_zone.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
A value object representing a time zone. A time zone is simply a named
offset (in seconds) from GMT. Note that two time zone objects are only
equivalent if they have both the same offset, and the same name.
</p>
<p>
A <a href="TimeZone.html">TimeZone</a> instance may be used to convert a
Time value to the corresponding time zone.
</p>
<p>
The class also includes <a href="TimeZone.html#M000026">all</a>, which
returns a list of <a href="TimeZone.html#M000026">all</a> <a
href="TimeZone.html">TimeZone</a> objects.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000022">&lt;=&gt;</a>&nbsp;&nbsp;
      <a href="#M000027">[]</a>&nbsp;&nbsp;
      <a href="#M000020">adjust</a>&nbsp;&nbsp;
      <a href="#M000026">all</a>&nbsp;&nbsp;
      <a href="#M000024">create</a>&nbsp;&nbsp;
      <a href="#M000017">formatted_offset</a>&nbsp;&nbsp;
      <a href="#M000016">new</a>&nbsp;&nbsp;
      <a href="#M000025">new</a>&nbsp;&nbsp;
      <a href="#M000018">now</a>&nbsp;&nbsp;
      <a href="#M000023">to_s</a>&nbsp;&nbsp;
      <a href="#M000019">today</a>&nbsp;&nbsp;
      <a href="#M000021">unadjust</a>&nbsp;&nbsp;
      <a href="#M000028">us_zones</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name">Comparable</span>
      </div>
    </div>

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">US_ZONES</td>
          <td>=</td>
          <td class="context-item-value">/US|Arizona|Indiana|Hawaii|Alaska/ unless defined?(US_ZONES)</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
A regular expression that matches the names of <a
href="TimeZone.html#M000026">all</a> time zones in the USA.

</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">name</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">utc_offset</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000027" class="method-detail">
        <a name="M000027"></a>

        <div class="method-heading">
          <a href="#M000027" class="method-signature">
          <span class="method-name">[]</span><span class="method-args">(arg)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Locate a specific time zone object. If the argument is a string, it is
interpreted to mean the name of the timezone to locate. If it is a numeric
value it is either the hour offset, or the second offset, of the timezone
to find. (The first one with that offset will be returned.) Returns
<tt>nil</tt> if no such time zone is known to the system.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000027-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 159</span>
159:     <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">arg</span>)
160:       <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">arg</span>
161:         <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
162:           <span class="ruby-identifier">all</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">z</span><span class="ruby-operator">|</span> <span class="ruby-identifier">z</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">arg</span> }
163:         <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Numeric</span>
164:           <span class="ruby-identifier">arg</span> <span class="ruby-operator">*=</span> <span class="ruby-value">3600</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">abs</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">13</span>
165:           <span class="ruby-identifier">all</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">z</span><span class="ruby-operator">|</span> <span class="ruby-identifier">z</span>.<span class="ruby-identifier">utc_offset</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">to_i</span> }
166:         <span class="ruby-keyword kw">else</span>
167:           <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;invalid argument to TimeZone[]: #{arg.inspect}&quot;</span>
168:       <span class="ruby-keyword kw">end</span>
169:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000026" class="method-detail">
        <a name="M000026"></a>

        <div class="method-heading">
          <a href="#M000026" class="method-signature">
          <span class="method-name">all</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Return an array of <a href="TimeZone.html#M000026">all</a> <a
href="TimeZone.html">TimeZone</a> objects. There are multiple <a
href="TimeZone.html">TimeZone</a> objects per time zone, in many cases, to
make it easier for users to find their own time zone.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000026-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 94</span>
 94:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all</span>
 95:       <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@zones</span>
 96:         <span class="ruby-ivar">@@zones</span> = []
 97:         [[<span class="ruby-value">-43_200</span>, <span class="ruby-value str">&quot;International Date Line West&quot;</span> ],
 98:          [<span class="ruby-value">-39_600</span>, <span class="ruby-value str">&quot;Midway Island&quot;</span>, <span class="ruby-value str">&quot;Samoa&quot;</span> ],
 99:          [<span class="ruby-value">-36_000</span>, <span class="ruby-value str">&quot;Hawaii&quot;</span> ],
100:          [<span class="ruby-value">-32_400</span>, <span class="ruby-value str">&quot;Alaska&quot;</span> ],
101:          [<span class="ruby-value">-28_800</span>, <span class="ruby-value str">&quot;Pacific Time (US &amp; Canada)&quot;</span>, <span class="ruby-value str">&quot;Tijuana&quot;</span> ],
102:          [<span class="ruby-value">-25_200</span>, <span class="ruby-value str">&quot;Mountain Time (US &amp; Canada)&quot;</span>, <span class="ruby-value str">&quot;Chihuahua&quot;</span>, <span class="ruby-value str">&quot;Mazatlan&quot;</span>, 
103:                    <span class="ruby-value str">&quot;Arizona&quot;</span> ],
104:          [<span class="ruby-value">-21_600</span>, <span class="ruby-value str">&quot;Central Time (US &amp; Canada)&quot;</span>, <span class="ruby-value str">&quot;Saskatchewan&quot;</span>, <span class="ruby-value str">&quot;Guadalajara&quot;</span>,
105:                    <span class="ruby-value str">&quot;Mexico City&quot;</span>, <span class="ruby-value str">&quot;Monterrey&quot;</span>, <span class="ruby-value str">&quot;Central America&quot;</span> ],
106:          [<span class="ruby-value">-18_000</span>, <span class="ruby-value str">&quot;Eastern Time (US &amp; Canada)&quot;</span>, <span class="ruby-value str">&quot;Indiana (East)&quot;</span>, <span class="ruby-value str">&quot;Bogota&quot;</span>,
107:                    <span class="ruby-value str">&quot;Lima&quot;</span>, <span class="ruby-value str">&quot;Quito&quot;</span> ],
108:          [<span class="ruby-value">-14_400</span>, <span class="ruby-value str">&quot;Atlantic Time (Canada)&quot;</span>, <span class="ruby-value str">&quot;Caracas&quot;</span>, <span class="ruby-value str">&quot;La Paz&quot;</span>, <span class="ruby-value str">&quot;Santiago&quot;</span> ],
109:          [<span class="ruby-value">-12_600</span>, <span class="ruby-value str">&quot;Newfoundland&quot;</span> ],
110:          [<span class="ruby-value">-10_800</span>, <span class="ruby-value str">&quot;Brasilia&quot;</span>, <span class="ruby-value str">&quot;Buenos Aires&quot;</span>, <span class="ruby-value str">&quot;Georgetown&quot;</span>, <span class="ruby-value str">&quot;Greenland&quot;</span> ],
111:          [ <span class="ruby-value">-7_200</span>, <span class="ruby-value str">&quot;Mid-Atlantic&quot;</span> ],
112:          [ <span class="ruby-value">-3_600</span>, <span class="ruby-value str">&quot;Azores&quot;</span>, <span class="ruby-value str">&quot;Cape Verde Is.&quot;</span> ],
113:          [      <span class="ruby-value">0</span>, <span class="ruby-value str">&quot;Dublin&quot;</span>, <span class="ruby-value str">&quot;Edinburgh&quot;</span>, <span class="ruby-value str">&quot;Lisbon&quot;</span>, <span class="ruby-value str">&quot;London&quot;</span>, <span class="ruby-value str">&quot;Casablanca&quot;</span>,
114:                    <span class="ruby-value str">&quot;Monrovia&quot;</span> ],
115:          [  <span class="ruby-value">3_600</span>, <span class="ruby-value str">&quot;Belgrade&quot;</span>, <span class="ruby-value str">&quot;Bratislava&quot;</span>, <span class="ruby-value str">&quot;Budapest&quot;</span>, <span class="ruby-value str">&quot;Ljubljana&quot;</span>, <span class="ruby-value str">&quot;Prague&quot;</span>,
116:                    <span class="ruby-value str">&quot;Sarajevo&quot;</span>, <span class="ruby-value str">&quot;Skopje&quot;</span>, <span class="ruby-value str">&quot;Warsaw&quot;</span>, <span class="ruby-value str">&quot;Zagreb&quot;</span>, <span class="ruby-value str">&quot;Brussels&quot;</span>,
117:                    <span class="ruby-value str">&quot;Copenhagen&quot;</span>, <span class="ruby-value str">&quot;Madrid&quot;</span>, <span class="ruby-value str">&quot;Paris&quot;</span>, <span class="ruby-value str">&quot;Amsterdam&quot;</span>, <span class="ruby-value str">&quot;Berlin&quot;</span>,
118:                    <span class="ruby-value str">&quot;Bern&quot;</span>, <span class="ruby-value str">&quot;Rome&quot;</span>, <span class="ruby-value str">&quot;Stockholm&quot;</span>, <span class="ruby-value str">&quot;Vienna&quot;</span>,
119:                    <span class="ruby-value str">&quot;West Central Africa&quot;</span> ],
120:          [  <span class="ruby-value">7_200</span>, <span class="ruby-value str">&quot;Bucharest&quot;</span>, <span class="ruby-value str">&quot;Cairo&quot;</span>, <span class="ruby-value str">&quot;Helsinki&quot;</span>, <span class="ruby-value str">&quot;Kyev&quot;</span>, <span class="ruby-value str">&quot;Riga&quot;</span>, <span class="ruby-value str">&quot;Sofia&quot;</span>,
121:                    <span class="ruby-value str">&quot;Tallinn&quot;</span>, <span class="ruby-value str">&quot;Vilnius&quot;</span>, <span class="ruby-value str">&quot;Athens&quot;</span>, <span class="ruby-value str">&quot;Istanbul&quot;</span>, <span class="ruby-value str">&quot;Minsk&quot;</span>,
122:                    <span class="ruby-value str">&quot;Jerusalem&quot;</span>, <span class="ruby-value str">&quot;Harare&quot;</span>, <span class="ruby-value str">&quot;Pretoria&quot;</span> ],
123:          [ <span class="ruby-value">10_800</span>, <span class="ruby-value str">&quot;Moscow&quot;</span>, <span class="ruby-value str">&quot;St. Petersburg&quot;</span>, <span class="ruby-value str">&quot;Volgograd&quot;</span>, <span class="ruby-value str">&quot;Kuwait&quot;</span>, <span class="ruby-value str">&quot;Riyadh&quot;</span>,
124:                    <span class="ruby-value str">&quot;Nairobi&quot;</span>, <span class="ruby-value str">&quot;Baghdad&quot;</span> ],
125:          [ <span class="ruby-value">12_600</span>, <span class="ruby-value str">&quot;Tehran&quot;</span> ],
126:          [ <span class="ruby-value">14_400</span>, <span class="ruby-value str">&quot;Abu Dhabi&quot;</span>, <span class="ruby-value str">&quot;Muscat&quot;</span>, <span class="ruby-value str">&quot;Baku&quot;</span>, <span class="ruby-value str">&quot;Tbilisi&quot;</span>, <span class="ruby-value str">&quot;Yerevan&quot;</span> ],
127:          [ <span class="ruby-value">16_200</span>, <span class="ruby-value str">&quot;Kabul&quot;</span> ],
128:          [ <span class="ruby-value">18_000</span>, <span class="ruby-value str">&quot;Ekaterinburg&quot;</span>, <span class="ruby-value str">&quot;Islamabad&quot;</span>, <span class="ruby-value str">&quot;Karachi&quot;</span>, <span class="ruby-value str">&quot;Tashkent&quot;</span> ],
129:          [ <span class="ruby-value">19_800</span>, <span class="ruby-value str">&quot;Chennai&quot;</span>, <span class="ruby-value str">&quot;Kolkata&quot;</span>, <span class="ruby-value str">&quot;Mumbai&quot;</span>, <span class="ruby-value str">&quot;New Delhi&quot;</span> ],
130:          [ <span class="ruby-value">20_700</span>, <span class="ruby-value str">&quot;Kathmandu&quot;</span> ],
131:          [ <span class="ruby-value">21_600</span>, <span class="ruby-value str">&quot;Astana&quot;</span>, <span class="ruby-value str">&quot;Dhaka&quot;</span>, <span class="ruby-value str">&quot;Sri Jayawardenepura&quot;</span>, <span class="ruby-value str">&quot;Almaty&quot;</span>,
132:                    <span class="ruby-value str">&quot;Novosibirsk&quot;</span> ],
133:          [ <span class="ruby-value">23_400</span>, <span class="ruby-value str">&quot;Rangoon&quot;</span> ],
134:          [ <span class="ruby-value">25_200</span>, <span class="ruby-value str">&quot;Bangkok&quot;</span>, <span class="ruby-value str">&quot;Hanoi&quot;</span>, <span class="ruby-value str">&quot;Jakarta&quot;</span>, <span class="ruby-value str">&quot;Krasnoyarsk&quot;</span> ],
135:          [ <span class="ruby-value">28_800</span>, <span class="ruby-value str">&quot;Beijing&quot;</span>, <span class="ruby-value str">&quot;Chongqing&quot;</span>, <span class="ruby-value str">&quot;Hong Kong&quot;</span>, <span class="ruby-value str">&quot;Urumqi&quot;</span>,
136:                    <span class="ruby-value str">&quot;Kuala Lumpur&quot;</span>, <span class="ruby-value str">&quot;Singapore&quot;</span>, <span class="ruby-value str">&quot;Taipei&quot;</span>, <span class="ruby-value str">&quot;Perth&quot;</span>, <span class="ruby-value str">&quot;Irkutsk&quot;</span>,
137:                    <span class="ruby-value str">&quot;Ulaan Bataar&quot;</span> ],
138:          [ <span class="ruby-value">32_400</span>, <span class="ruby-value str">&quot;Seoul&quot;</span>, <span class="ruby-value str">&quot;Osaka&quot;</span>, <span class="ruby-value str">&quot;Sapporo&quot;</span>, <span class="ruby-value str">&quot;Tokyo&quot;</span>, <span class="ruby-value str">&quot;Yakutsk&quot;</span> ],
139:          [ <span class="ruby-value">34_200</span>, <span class="ruby-value str">&quot;Darwin&quot;</span>, <span class="ruby-value str">&quot;Adelaide&quot;</span> ],
140:          [ <span class="ruby-value">36_000</span>, <span class="ruby-value str">&quot;Canberra&quot;</span>, <span class="ruby-value str">&quot;Melbourne&quot;</span>, <span class="ruby-value str">&quot;Sydney&quot;</span>, <span class="ruby-value str">&quot;Brisbane&quot;</span>, <span class="ruby-value str">&quot;Hobart&quot;</span>,
141:                    <span class="ruby-value str">&quot;Vladivostok&quot;</span>, <span class="ruby-value str">&quot;Guam&quot;</span>, <span class="ruby-value str">&quot;Port Moresby&quot;</span> ],
142:          [ <span class="ruby-value">39_600</span>, <span class="ruby-value str">&quot;Magadan&quot;</span>, <span class="ruby-value str">&quot;Solomon Is.&quot;</span>, <span class="ruby-value str">&quot;New Caledonia&quot;</span> ],
143:          [ <span class="ruby-value">43_200</span>, <span class="ruby-value str">&quot;Fiji&quot;</span>, <span class="ruby-value str">&quot;Kamchatka&quot;</span>, <span class="ruby-value str">&quot;Marshall Is.&quot;</span>, <span class="ruby-value str">&quot;Auckland&quot;</span>,
144:                    <span class="ruby-value str">&quot;Wellington&quot;</span> ],
145:          [ <span class="ruby-value">46_800</span>, <span class="ruby-value str">&quot;Nuku'alofa&quot;</span> ]].
146:         <span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">offset</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">places</span><span class="ruby-operator">|</span>
147:           <span class="ruby-identifier">places</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">place</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@@zones</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">place</span>, <span class="ruby-identifier">offset</span>).<span class="ruby-identifier">freeze</span> }
148:         <span class="ruby-keyword kw">end</span>
149:         <span class="ruby-ivar">@@zones</span>.<span class="ruby-identifier">sort!</span>
150:       <span class="ruby-keyword kw">end</span>
151:       <span class="ruby-ivar">@@zones</span>
152:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="#M000024" class="method-signature">
          <span class="method-name">create</span><span class="method-args">(name, offset)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Create a <a href="TimeZone.html#M000016">new</a> <a
href="TimeZone.html">TimeZone</a> instance with the given name and offset.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000024-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 78</span>
78:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">offset</span>)
79:       <span class="ruby-identifier">zone</span> = <span class="ruby-identifier">allocate</span>
80:       <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">send!</span>(<span class="ruby-identifier">:initialize</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">offset</span>)
81:       <span class="ruby-identifier">zone</span>
82:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000016" class="method-detail">
        <a name="M000016"></a>

        <div class="method-heading">
          <a href="#M000016" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(name, utc_offset)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Create a <a href="TimeZone.html#M000016">new</a> <a
href="TimeZone.html">TimeZone</a> object with the given name and offset.
The offset is the number of seconds that this time zone is offset from UTC
(GMT). Seconds were chosen as the offset unit because that is the unit that
Ruby uses to represent time zone offsets (see Time#utc_offset).
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000016-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 18</span>
18:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">utc_offset</span>)
19:     <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
20:     <span class="ruby-ivar">@utc_offset</span> = <span class="ruby-identifier">utc_offset</span>
21:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000025" class="method-detail">
        <a name="M000025"></a>

        <div class="method-heading">
          <a href="#M000025" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Return a <a href="TimeZone.html">TimeZone</a> instance with the given name,
or <tt>nil</tt> if no such <a href="TimeZone.html">TimeZone</a> instance
exists. (This exists to support the use of this class with the composed_of
macro.)
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000025-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 87</span>
87:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>)
88:       <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">name</span>]
89:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000028" class="method-detail">
        <a name="M000028"></a>

        <div class="method-heading">
          <a href="#M000028" class="method-signature">
          <span class="method-name">us_zones</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
A convenience method for returning a collection of <a
href="TimeZone.html">TimeZone</a> objects for time zones in the USA.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000028-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 177</span>
177:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">us_zones</span>
178:       <span class="ruby-identifier">all</span>.<span class="ruby-identifier">find_all</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">z</span><span class="ruby-operator">|</span> <span class="ruby-identifier">z</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">US_ZONES</span> }
179:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="#M000022" class="method-signature">
          <span class="method-name">&lt;=&gt;</span><span class="method-args">(zone)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Compare this time zone to the parameter. The two are comapred first on
their offsets, and then by name.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000022-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 63</span>
63:   <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">zone</span>)
64:     <span class="ruby-identifier">result</span> = (<span class="ruby-identifier">utc_offset</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">utc_offset</span>)
65:     <span class="ruby-identifier">result</span> = (<span class="ruby-identifier">name</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">name</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
66:     <span class="ruby-identifier">result</span>
67:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <a href="#M000020" class="method-signature">
          <span class="method-name">adjust</span><span class="method-args">(time)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Adjust the given time to the time zone represented by <tt>self</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000020-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 47</span>
47:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">adjust</span>(<span class="ruby-identifier">time</span>)
48:     <span class="ruby-identifier">time</span> = <span class="ruby-identifier">time</span>.<span class="ruby-identifier">to_time</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">time</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Time</span>)
49:     <span class="ruby-identifier">time</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">utc_offset</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">time</span>.<span class="ruby-identifier">utc_offset</span>
50:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000017" class="method-detail">
        <a name="M000017"></a>

        <div class="method-heading">
          <a href="#M000017" class="method-signature">
          <span class="method-name">formatted_offset</span><span class="method-args">( colon=true )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the offset of this time zone as a formatted string, of the format
&quot;+HH:MM&quot;. If the offset is zero, this returns the empty string.
If <tt>colon</tt> is false, a colon will not be inserted into the result.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000017-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 27</span>
27:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">formatted_offset</span>( <span class="ruby-identifier">colon</span>=<span class="ruby-keyword kw">true</span> )
28:     <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">utc_offset</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
29:     <span class="ruby-identifier">sign</span> = (<span class="ruby-identifier">utc_offset</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-value">-1</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>)
30:     <span class="ruby-identifier">hours</span> = <span class="ruby-identifier">utc_offset</span>.<span class="ruby-identifier">abs</span> <span class="ruby-operator">/</span> <span class="ruby-value">3600</span>
31:     <span class="ruby-identifier">minutes</span> = (<span class="ruby-identifier">utc_offset</span>.<span class="ruby-identifier">abs</span> <span class="ruby-operator">%</span> <span class="ruby-value">3600</span>) <span class="ruby-operator">/</span> <span class="ruby-value">60</span>
32:     <span class="ruby-value str">&quot;%+03d%s%02d&quot;</span> <span class="ruby-operator">%</span> [ <span class="ruby-identifier">hours</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">sign</span>, <span class="ruby-identifier">colon</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot;:&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">minutes</span> ]
33:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000018" class="method-detail">
        <a name="M000018"></a>

        <div class="method-heading">
          <a href="#M000018" class="method-signature">
          <span class="method-name">now</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Compute and return the current time, in the time zone represented by
<tt>self</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000018-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 37</span>
37:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">now</span>
38:     <span class="ruby-identifier">adjust</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>)
39:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="#M000023" class="method-signature">
          <span class="method-name">to_s</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns a textual representation of this time zone.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000023-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 70</span>
70:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
71:     <span class="ruby-node">&quot;(UTC#{formatted_offset}) #{name}&quot;</span>
72:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="#M000019" class="method-signature">
          <span class="method-name">today</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Return the current date in this time zone.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000019-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 42</span>
42:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">today</span>
43:     <span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_date</span>
44:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="#M000021" class="method-signature">
          <span class="method-name">unadjust</span><span class="method-args">(time)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Reinterprets the given time value as a time in the current time zone, and
then adjusts it to return the corresponding time in the local time zone.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000021-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/values/time_zone.rb, line 55</span>
55:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unadjust</span>(<span class="ruby-identifier">time</span>)
56:     <span class="ruby-identifier">time</span> = <span class="ruby-identifier">time</span>.<span class="ruby-identifier">to_time</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">time</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Time</span>)
57:     <span class="ruby-identifier">time</span> = <span class="ruby-identifier">time</span>.<span class="ruby-identifier">localtime</span>
58:     <span class="ruby-identifier">time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">utc_offset</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">time</span>.<span class="ruby-identifier">utc_offset</span>
59:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>